Skip to content

Integrate host-owned Media into JamPeerTransport-on-Seity - #1217

Draft
replghost wants to merge 87 commits into
feat/jam-peer-transport-on-seityfrom
feat/media-on-jam-seity
Draft

replghost wants to merge 87 commits into
feat/jam-peer-transport-on-seityfrom
feat/media-on-jam-seity

Conversation

@replghost

@replghost replghost commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Integration layer that adds the host-owned Media service (#838, RFC #839) to the JamPeerTransport-on-Seity line (#1011), so the dotli layer that deploys paseo.fyi can vendor one host with Seity, JamPeerTransport and Media.

The integration began with a --no-ff merge:

It now also integrates the Tommy platform fixes from #1216 and subsequent Media updates. Source feature layers remain separate; this PR assembles them above #1011.

Media in one paragraph

Products get calling without touching WebRTC. The host owns capture, signaling (sealed packets over the Statement Store), relay-only ICE through TURN, and picture compositing. Products see opaque session, participant and operation handles, authoritative snapshots, peer product-account keys, and submit picture rectangles. No SDP, ICE candidates, IP addresses, device ids or media bytes reach product memory. Calling consent is a separate permission scoped to product, network and account; camera and microphone keep their own device consent.

Wire

  • Media is prototype wire trait 218, methods 0–10. Sequential trait 20 is Contacts upstream; 218 keeps this unreviewed service clear of the range assigned in merge order. Only the trait byte moves when it is allocated for real.
  • RemotePermission order: …, StatementSubmit, JamPeers, Calling (JamPeers keeps 5, already deployed on paseo.fyi).
  • PermissionAuthorizationRequest order: …, ProfileDisclosure (6), Calling (7).

Initial Media qualification (historical)

  • cargo test -p truapi --lib: 1615 passed (media 28, permission 103, jam 10, profile 31, calling 7)
  • bun test: truapi-host 371, truapi 921, js/container 126
  • Playground media specs (real Chromium + loopback coturn): 6/6, including "peers connect through TURN and signal only relay candidates" and "host and reflexive candidates never leave the backend"
  • CI clippy: three lints already present on 795a40820 (unnecessary_lazy_evaluations in capabilities/platform.rs, two too_many_arguments in the receiving code); none in Media code
  • Live: two Epoca desktop instances on Paseo Next V2 completed calls in both directions over the default light client with the same Media code (Epoca vendors the fc86c56 variant of this layer)

Draft: not for merge; it exists so the paseo.fyi integration layer has a pushed host revision and review surface.

Current integration qualification

  • Browser SDK provenance: host JavaScript rebuilt from 8e735637702df560eb3af7853301d06cf1c942fb; client and production/testing signing-host WASM retain the verified 44b87fea6fbe430589bb53c31a3e38b620ad5374 build. The intervening changes do not change Rust/WASM. All 110 host archive files and 143 client archive files match the browser vendor, allowing only its declared local client dependency override.
  • Host JavaScript: 370 tests passed; real Chromium/coturn Media backend: 8 tests passed, including picture stability and late viewport replay.
  • Rust qualification for the retained build: 1,647 core and 39 wire/integration tests passed; Android products: 317 tests across 60 suites passed.
  • iOS CI at ba1f865ac: core, simulator app build and tests passed; xcresult reports 2,452 passed, zero failed/skipped (2,640 parameterized device executions). The later Media change is browser TypeScript only.
  • Signed iOS archive remains blocked by the missing readonly-match MediaBroadcastExtension development profile. Signing and distribution remain CI-owned; this is not a claim that all repository CI is green.
  • Integrated platform behavior includes request-correlated SSO decoding, bounded/revocable automatic Bulletin uploads with cross-runtime CAS, canonical trusted-product notification policy, and selected iOS theme propagation.

Known qualification limits: the exact legacy TrUAPI 0.7 storage probe still times out; no claim is made that historical #263 is fixed. Physical-device theme appearance, fully-quit native notification activation, and Tommy’s historical paired-device identity case are not covered by the simulator/local-browser evidence.

Adds the generic host-owned Media service: v01 Media wire types and
methods 0-10 at prototype wire trait 218, RemotePermission::Calling,
host-core media sessions, groups, signaling and backend boundaries,
platform media capabilities, browser media backend for the JS host,
native Android/iOS media backends, and playground media specs.

Squashes:
- wip(media): preserve implementation before approved upstream integration
- fix(media): keep receive-only sessions on device revocation; wait for
  backend session before placing pictures
- refactor(media): move Media to prototype wire trait 218
Media session_subscribe waited for MediaSignaling to start, so a cold
light client ended the stream with NotConnected before any snapshot.

Subscribing now only probes the backend and starts observation. One
background connector owns signaling: it starts it, drives its events,
and after a failure or loss restarts it with backoff (500 ms doubling
to 10 s) until the runtime closes. Each binding is still fenced by the
current authority and a new epoch. Mutations that need signaling wait
for the binding within their operation deadline and skip the pending
backoff.
…er starts

The core admits a participant, and the product sees it, before the call
handshake asks the backend to create its peer. The browser backend
re-checked remote surfaces against its own peer table and rejected those
rectangles with InvalidHandle, so Vox showed "Pictures not placed" while
a call was negotiating. The core already validates participant handles;
the backend now queues the rectangle and renders it once the peer media
is live, like the Android and iOS backends. Unknown handles still fail
in the core.
Always construct RTCPeerConnection with iceTransportPolicy relay and drop
the optional override. Never signal a non-relay candidate, neither as an
IceCandidate event nor embedded in a description. The playground media
specs now run against a loopback coturn relay.
Lock navigator.mediaDevices.enumerateDevices on the instance and every
prototype with the same NotAllowedError as capture.
Size the event queue for a full 256-statement page plus control headroom,
and admit only messages a lagging consumer has room for. Unadmitted
packets are not replay-recorded, so a later delivery still succeeds and
the endpoint no longer ends every call with ConnectivityLost.
A waiter parked while a signaling attempt runs found no backoff to wake,
so the attempt's failure still waited a full backoff. The retry request
is now sticky and consumed by the next backoff wait.
…layer

Merge feat/media-sessions (Media service, prototype wire trait 218, on #709
a78944c) into the integration revision 795a408 that #291 vendors.

- RemotePermission keeps JamPeers at positional index 5 and appends
  Calling at 6 (TS codegen encodes variants positionally).
- PermissionAuthorizationRequest keeps the deployed ProfileDisclosure at
  codec index 6 and moves Calling to index 7.
- Platform super-trait, runtime adapters and wasm wiring carry both the
  Profile and Media platforms; JamPeerSession is retained.
- Codegen keeps the receiving layer's Option<codec>/Option<bytes> argument
  form ahead of Media's generic Option fallback, and its receiving test
  passes Media's private_media flag.
- The mock-permission arm count covers both JamPeers and Calling (16).
@github-actions github-actions Bot added area:js Touches the TypeScript packages, the playground or the explorer area:core Touches the Rust core under rust/crates area:ios Touches the iOS host app or the iOS packages area:android Touches the Android host app or the Android packages labels Oct 6, 2026
Preserve Media's generalized optional callback codecs and exports. Drop a timing-dependent wording assertion; structured cancellation and SSO cleanup coverage remain.
attachmentIsolated() probed the product frame with a discarded
`frame.contentWindow.document` read inside try/catch. dotli's production
build tells rolldown/oxc that property reads have no side effects, which
deletes the read and leaves the check always "not isolated", so attach()
failed with SurfaceUnavailable on paseo.fyi. Use contentDocument === null,
whose value is used and which is null exactly for cross-origin and opaque
sandboxed documents.

The new media spec runs the decision in Chromium against tsc, esbuild
--minify and dotli-configured rolldown builds.
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

This pull request touches an app, which is not built by default. Add a label for each build you want:

  • iOS simulator build, ios-simulator-build: builds the iOS app, runs its tests and attaches a build for the iOS Simulator on a Mac.
  • iOS device build, ios-device-build: attaches a signed build that installs on a registered iPhone or iPad.
  • Android build, android-device-build: attaches an APK that installs on an Android phone or an emulator.

Each starts as soon as it is added and follows the branch from then on.

@socket-security

socket-security Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcargo/​hpke@​0.12.0100100100100100

View full report

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Bundle size report

Compared with main at 90dbd11.

Raw Gzip Brotli
truapi-host 8.99 MiB (+197.1 KiB, +2.2%) 6.11 MiB (+150.4 KiB, +2.5%) 5.71 MiB (+121.2 KiB, +2.1%)
truapi-provider 4.04 MiB (-5.0 KiB, -0.1%) 1.27 MiB (-12 B) 960.0 KiB (-2.0 KiB, -0.2%)
truapi 6.93 MiB (-1.82 MiB, -20.8%) 1004.2 KiB (-252.8 KiB, -20.1%) 819.2 KiB (-199.3 KiB, -19.6%)
trinity-stack removed removed removed
Total 19.95 MiB (-2.26 MiB, -10.2%) 8.36 MiB (-350.4 KiB, -3.9%) 7.45 MiB (-285.2 KiB, -3.6%)

WebAssembly modules

Raw Gzip Brotli
truapi-host/wasm/web/truapi_server_bg.wasm 3.61 MiB (-52.4 KiB, -1.4%) 1.36 MiB (+99.8 KiB, +7.7%) 1.01 MiB (+78.0 KiB, +8.1%)
truapi-host/wasm/web/truapi_verifiable_bg.wasm 4.89 MiB 4.64 MiB (-11 B) 4.61 MiB (-192 B)
truapi-provider/truapi_provider_bg.wasm 3.99 MiB (-4.7 KiB, -0.1%) 1.26 MiB (+84 B) 952.3 KiB (-1.9 KiB, -0.2%)
Changed files (71)
Raw Gzip Brotli
trinity-stack/wasm/trinity_stack_bg.wasm removed removed removed
truapi/explorer/codegen/versions/0.31.0/types.js removed removed removed
truapi/explorer/codegen/versions/0.30.0/types.js removed removed removed
truapi/explorer/codegen/versions/0.29.0/types.js removed removed removed
truapi/explorer/codegen/versions/0.28.0/types.js removed removed removed
truapi/explorer/codegen/versions/0.27.0/types.js removed removed removed
truapi/explorer/codegen/versions/0.26.0/types.js removed removed removed
truapi/explorer/codegen/types.js 438.7 KiB (+100.3 KiB, +29.6%) 63.3 KiB (+15.0 KiB, +31.1%) 49.4 KiB (+12.5 KiB, +33.9%)
truapi/explorer/codegen/versions/0.31.0/services.js removed removed removed
truapi-host/web/browser-media-backend.js (new) 81.7 KiB 17.2 KiB 14.6 KiB
truapi/playground/codegen/truapi-dts.js 486.8 KiB (+80.9 KiB, +19.9%) 87.3 KiB (+16.5 KiB, +23.4%) 68.8 KiB (+12.6 KiB, +22.5%)
truapi/explorer/codegen/versions/0.30.0/services.js removed removed removed
truapi/explorer/codegen/versions/0.29.0/services.js removed removed removed
truapi/explorer/codegen/versions/0.28.0/services.js removed removed removed
truapi/explorer/codegen/versions/0.27.0/services.js removed removed removed
truapi/explorer/codegen/versions/0.26.0/services.js removed removed removed
truapi-host/wasm/web/truapi_server_bg.wasm 3.61 MiB (-52.4 KiB, -1.4%) 1.36 MiB (+99.8 KiB, +7.7%) 1.01 MiB (+78.0 KiB, +8.1%)
trinity-stack/wasm/trinity_stack.js removed removed removed
truapi-host/browser-receiving-worker.js (new) 33.8 KiB 6.6 KiB 5.8 KiB
truapi/jam-peer-transport.js (new) 30.4 KiB 6.7 KiB 5.8 KiB
truapi/playground/codegen/services.js 156.9 KiB (+26.2 KiB, +20.0%) 25.9 KiB (+5.4 KiB, +26.5%) 21.6 KiB (+4.4 KiB, +25.8%)
truapi-host/worker-runtime.js 49.0 KiB (+23.9 KiB, +95.3%) 11.5 KiB (+6.1 KiB, +112.3%) 10.1 KiB (+5.4 KiB, +113.4%)
truapi/generated/types.js 114.0 KiB (+22.2 KiB, +24.2%) 14.3 KiB (+2.9 KiB, +25.1%) 12.0 KiB (+2.4 KiB, +25.6%)
truapi-host/web/native-chat-files.js (new) 20.5 KiB 4.6 KiB 4.0 KiB
truapi-host/wasm/web/truapi_server.js 80.3 KiB (+19.0 KiB, +31.0%) 12.6 KiB (+1.7 KiB, +15.1%) 10.8 KiB (+1.4 KiB, +14.6%)
truapi/generated/client.js 116.9 KiB (+18.7 KiB, +19.0%) 19.0 KiB (+3.7 KiB, +24.1%) 15.7 KiB (+2.9 KiB, +23.2%)
truapi-host/web/create-worker-host-runtime.js 74.0 KiB (+18.6 KiB, +33.7%) 15.0 KiB (+3.0 KiB, +24.7%) 13.0 KiB (+2.5 KiB, +24.3%)
truapi-host/worker-debugger-link.js removed removed removed
truapi-host/web/native-chat-media.js (new) 12.0 KiB 3.3 KiB 2.9 KiB
truapi-host/generated/host-callbacks.js 25.0 KiB (+11.5 KiB, +85.9%) 6.9 KiB (+2.8 KiB, +68.3%) 5.9 KiB (+2.4 KiB, +69.1%)
truapi/notification-envelope.js (new) 10.7 KiB 3.2 KiB 2.8 KiB
trinity-stack/dist/project.js removed removed removed
truapi/jam-peer-transport-cert.js (new) 9.0 KiB 3.4 KiB 3.0 KiB
truapi-host/generated/host-callbacks-adapter.js 16.0 KiB (+8.9 KiB, +124.6%) 3.1 KiB (+1.5 KiB, +91.3%) 2.7 KiB (+1.3 KiB, +90.8%)
truapi/notification-container.js (new) 7.9 KiB 2.3 KiB 2.0 KiB
trinity-stack/dist/reader.js removed removed removed
truapi-host/generated/worker-callbacks.js 14.1 KiB (+6.8 KiB, +92.1%) 2.5 KiB (+1.0 KiB, +67.4%) 2.1 KiB (+861 B, +68.4%)
truapi-host/adapter-support.js 10.1 KiB (+6.7 KiB, +195.2%) 2.9 KiB (+1.6 KiB, +117.6%) 2.5 KiB (+1.3 KiB, +110.7%)
truapi-host/browser-receiving.js (new) 6.6 KiB 1.9 KiB 1.7 KiB
truapi-host/wallet-allowances.js (new) 6.5 KiB 1.7 KiB 1.5 KiB
truapi/generated/wire-decode.js 44.1 KiB (+6.4 KiB, +16.8%) 4.4 KiB (+659 B, +17.0%) 3.7 KiB (+533 B, +16.3%)
truapi-host/browser-receiving-transport.js (new) 6.1 KiB 2.2 KiB 1.9 KiB
truapi-host/worker-local-identity.js (new) 5.7 KiB 1.8 KiB 1.5 KiB
trinity-stack/dist/index.js removed removed removed
truapi-provider/truapi_provider_bg.wasm 3.99 MiB (-4.7 KiB, -0.1%) 1.26 MiB (+84 B) 952.3 KiB (-1.9 KiB, -0.2%)
truapi/client.js 34.4 KiB (-4.3 KiB, -11.0%) 8.3 KiB (-725 B, -7.8%) 7.1 KiB (-645 B, -8.1%)
truapi-host/generated/markers.js removed removed removed
truapi-host/web/create-iframe-host.js 3.7 KiB (-3.2 KiB, -45.9%) 1.4 KiB (-1015 B, -42.0%) 1.1 KiB (-902 B, -44.8%)
trinity-stack/dist/cli.js removed removed removed
trinity-stack/dist/fetch.js removed removed removed
truapi/generated/wire-table.js 13.6 KiB (+2.0 KiB, +17.7%) 2.1 KiB (+261 B, +13.6%) 1.7 KiB (+191 B, +12.7%)
truapi-host/locale.js (new) 1.9 KiB 689 B 622 B
truapi-host/web/loopback-statements.js 9.8 KiB (-1.9 KiB, -16.2%) 3.2 KiB (-581 B, -14.9%) 2.8 KiB (-510 B, -15.2%)
truapi/transport.js 16.6 KiB (-1.6 KiB, -8.6%) 4.4 KiB (-421 B, -8.6%) 3.7 KiB (-357 B, -8.5%)
truapi-host/runtime.js 2.3 KiB (+1.6 KiB, +215.6%) 855 B (+419 B, +96.1%) 692 B (+361 B, +109.1%)
truapi/explorer/versions.js 5.5 KiB (-1.3 KiB, -18.6%) 832 B (-118 B, -12.4%) 560 B (-52 B, -8.5%)
truapi/host-connection.js 7.7 KiB (-1.0 KiB, -11.8%) 2.0 KiB (-354 B, -15.0%) 1.7 KiB (-302 B, -14.9%)
truapi/development.js (new) 942 B 508 B 446 B
truapi/scale.js 5.5 KiB (-867 B, -13.4%) 2.1 KiB (-242 B, -10.1%) 1.8 KiB (-215 B, -10.3%)
trinity-stack/dist/wasm.js removed removed removed
truapi-host/worker-permission-authorization.js 3.2 KiB (+674 B, +26.1%) 432 B (+55 B, +14.6%) 387 B (+81 B, +26.5%)
truapi-host/worker-dispatch.js 1.8 KiB (+467 B, +33.1%) 525 B (+125 B, +31.3%) 446 B (+100 B, +28.9%)
truapi-host/markers.js removed removed removed
truapi-host/wasm/web/snippets/truapi/inline0.js 743 B (-353 B, -32.2%) 351 B (-159 B, -31.2%) 313 B (-129 B, -29.2%)
trinity-stack/dist/time.js removed removed removed
truapi-provider/truapi_provider.js 46.3 KiB (-310 B, -0.6%) 9.0 KiB (-96 B, -1.0%) 7.7 KiB (-83 B, -1.0%)
truapi-host/worker-protocol.js 3.7 KiB (+282 B, +8.1%) 1.4 KiB (+157 B, +12.2%) 1.1 KiB (+114 B, +10.7%)
truapi/sandbox.js 13.5 KiB (-254 B, -1.8%) 4.2 KiB (-63 B, -1.4%) 3.6 KiB (-66 B, -1.8%)
truapi-host/web/index.js 328 B (+183 B, +126.2%) 177 B (+63 B, +55.3%) 152 B (+34 B, +28.8%)
truapi/index.js 591 B (+34 B, +6.1%) 293 B (+8 B, +2.8%) 224 B (+4 B, +1.8%)
truapi-host/index.js 80 B (+1 B, +1.3%) 80 B (-10 B, -11.1%) 67 B (-13 B, -16.3%)

Commit: bd5a58c

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

CI Status: not green, 3 items need attention.

  • rust: failure
  • ts-host: failure
  • host-wasm: failure
All job results
job result
android-bindings success
bundle-size success
changes success
changeset-guard success
cli-package success
codegen success
e2e skipped
explorer success
headless-install success
host-android-bindings success
host-android-detekt success
host-wasm failure
ios-bindings success
ios-swift success
licenses success
playground success
provider-android-bindings success
release-guard success
rust failure
ts-client success
ts-debugger success
ts-host failure
wasm-provider success
workflow-lint skipped

Signing credentials: valid as of 2026-11-13

Commit bd5a58c7 · run log

A Statement Store submit that outlives its budget (e.g. while the light
client stalls) or loses its transport may still have been accepted. The
caller then failed its outgoing link with ConnectivityLost while the
callee rang, accepted, and waited for a Commit that never came
(Unanswered). Invite, Accept and Commit are idempotent at the receiver,
so retry them (up to four attempts, one second apart, fenced again after
the wait) while the link would still send them; other messages keep the
existing failure path.
@github-actions github-actions Bot added the area:docs Touches documentation label Oct 6, 2026
# Conflicts:
#	rust/crates/truapi/src/wasm.rs
# Conflicts:
#	rust/crates/truapi-client/src/generated.rs
#	rust/crates/truapi/src/host_core.rs
#	rust/crates/truapi/src/wasm.rs
# Conflicts:
#	rust/crates/truapi-client/src/generated.rs
# Conflicts:
#	rust/crates/truapi/src/host_core.rs
# Conflicts:
#	rust/crates/truapi/src/host_core.rs
@TarikGul TarikGul added the size:XXL Pull requests only. 2000 lines or more; split it, or say in the description why it cannot be label Oct 30, 2026
replghost and others added 7 commits November 9, 2026 14:22
…gration

JAM peer listener and chunked transport contract (trait 111 methods 7-9)
that the validator guest needs for inbound duties.

# Conflicts:
#	rust/crates/truapi-client/src/generated.rs
#	rust/crates/truapi/src/lib.rs
Brings the validator custody layer (trait 112, RemotePermission::Validator)
onto #1217. RemotePermission::Validator is encoded at index 112, as on the
TrUAPI 0.30 line, because this branch already uses positional index 6 for
Calling. Validator custody stays outside trusted-product defaults: a trusted
product still gets NotDetermined for Validator and must ask. Permission
denials revoke validator custody before and after persisting the decision,
alongside the existing Media revocation. Mobile hosts have no protected
custody and deny the permission.

Conflicted files keep this branch's formatting; only the merged lines
change. Generated outputs are regenerated.
replghost added a commit to paritytech/dotli-community that referenced this pull request Nov 14, 2026
Re-vendors @parity/truapi and @parity/truapi-host from
paritytech/trinity-user-agents#1217 at 9608ac911, which merges the JAM peer
transport duty contract and validator custody (trait 112). The browser host
has no protected custody: the core reports custody as unsupported and the
permission callback denies Validator.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:android Touches the Android host app or the Android packages area:core Touches the Rust core under rust/crates area:docs Touches documentation area:ios Touches the iOS host app or the iOS packages area:js Touches the TypeScript packages, the playground or the explorer area:rfc An RFC, or work tracked by one under docs/rfcs ci:android-emulator-tests Run the Android instrumented tests on an emulator ci:ios-simulator Build the iOS app for the simulator and attach it size:XXL Pull requests only. 2000 lines or more; split it, or say in the description why it cannot be

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants